/*
 * @(#)BooleanPropertySection.java.java        0.00 2008/01/05
 */
package jp.ekasi.pms.ui.properties.tabbed.common.section;

import jp.ekasi.common.util.StringUtil;

import org.eclipse.emf.ecore.EAttribute;

/**
 * @author Yuusuke Hikime
 */
public abstract class AbstractBooleanPropertySection extends AbstractEnumerationPropertySection {
	
	protected Boolean[] booleanValues = new Boolean[] {
			Boolean.TRUE,
			Boolean.FALSE
	};
	
	protected String[] booleanStrings = new String[] {
			Boolean.TRUE.toString(),
			Boolean.FALSE.toString()
	};
	
	@Override
	protected String[] getEnumerationFeatureValues() {
		return booleanStrings;
	}

	@Override
	protected String getFeatureAsText() {
		if(eObject.eGet(getFeature())==null) {
			return StringUtil.EMPTY;
		}
		return eObject.eGet(getFeature()).toString();
	}

	@Override
	protected Object getFeatureValue(int index) {
		return booleanValues[index];
	}

	@Override
	protected boolean isEqual(int index) {
		return getFeatureValue(index)==eObject.eGet(getFeature());
	}

}
